{layout name="layout/header" /}
<link href="root/css/plugins/footable/footable.core.css" rel="stylesheet">
<link href="root/css/plugins/iCheck/custom.css" rel="stylesheet">

<link href="root/css/plugins/switchery/switchery.css" rel="stylesheet">
<script src="root/js/plugins/switchery/switchery.js"></script>
<!--<link href="root/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">-->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><a href="{:url('index')}">活动列表</a>/{$vote.name} 投票记录</h5>
                </div>
                <div class="ibox-content">
                    <p>
                        <a type="button" class="btn btn-outline btn-danger" id="empty">清空投票记录</a>
                        <!--<a type="button" class="btn btn-outline btn-success" href="{:url('addWhite',['vote_id'=>$vote.id])}">新增</a>-->
                        <button type="button" class="btn btn-primary btn-outline refresh">刷新</button>
                        <a type="button" class="btn btn-primary btn-outline" href="{:url('vote/index')}">返回列表</a>
                    </p>
                    <form class="form-inline">

                        <div class="form-group">
                            <input type="text" id="keyword" class="form-control" placeholder="编号/名称" value="{$keyword}">
                        </div>
                        <a class="btn btn-success search">查询</a>
                    </form>
                </div>

                <div class="ibox-content">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>编号</th>
                                <th>名称</th>
                                <th>投票手机</th>
                                <th>投票IP</th>
                                <th>设备号</th>
                                <th>投票数量</th>
                                <th>投票时间</th>
                            </tr>
                        </thead>
                        <tbody>
                        {volist name="data.list" id="vo"}
                        <tr pid="{$vo.id}" >
                            <td>{$vo.mid}</td>
                            <td>{$vo.name}</td>
                            <td>{$vo.mobile}</td>
                            <td>{$vo.ip}</td>
                            <td>{$vo.device_id}</td>
                            <td>{$vo.nums}</td>
                            <td>{$vo.addtime|date="Y-m-d H:i",###}</td>

                        </tr>
                        {/volist}
                        </tbody>
                        <tfoot>
                        <tr>
                            <td colspan="5">
                                {$data.page}
                            </td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--layer-->
<script src="root/js/plugins/layer/layer.min.js"></script>
<!-- iCheck -->
<script src="root/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function() {
        //搜索
        $('.search').click(function () {
            var keyword = $("#keyword").val().trim();
            var url = "{:url('index',['vote_id'=>$vote.id])}"+'/keyword/'+keyword;
            window.location.href = url;
        });
        //清空
        $('#empty').click(function(){
            var id = "{$vote.id}";
            var $this = $(this);

            layer.confirm('确定要清空该活动所有投票记录吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                $.ajax({
                    url:"{:url('emptyData')}",
                    type:'post',
                    data:{id:id},
                    dataType:'json',
                    success:function (data) {
                        layer.msg(data.msg);
                        if(data.code ==1){
                            setTimeout(function () {
                                window.location.reload()
                            },1500)
                        }
                    }
                })
            }, function(){

            });

        });

    });
</script>
